package com.share.dymamic.datasource;

import java.lang.reflect.Field;

public class ReflectionUtils {
	public static Object getFieldValue(String fieldName, @SuppressWarnings("rawtypes") Class clazz, Object target) {
		try {
			Field targetField = clazz.getDeclaredField(fieldName);
			targetField.setAccessible(true);
			return targetField.get(target);
		} 
		catch (NoSuchFieldException e) {
			e.printStackTrace();
		} 
		catch (SecurityException e) {
			e.printStackTrace();
		} 
		catch (IllegalArgumentException e) {
			e.printStackTrace();
		} 
		catch (IllegalAccessException e) {
			e.printStackTrace();
		}
		return null;
	}
}
